from PyCmpltrtok.common import uuid
from logger_util import build_logger
from base_model_worker import BaseModelWorker, app
import argparse

worker_id = uuid()
logger = build_logger("model_worker", f"model_worker_{worker_id}.log")


class ModelWorker(BaseModelWorker):
    
    def __init__(self, worker_id: str):
        super().__init__(worker_id)
        
        
def create_model_worker():
    parser = argparse.ArgumentParser()
    parser.add_argument("--port", type=int, default=6009)
    args = parser.parse_args()
    
    worker = ModelWorker(worker_id, )
    return args, worker
        
if '__main__' == __name__:
    import uvicorn
    
    args, worker = create_model_worker()
    uvicorn.run(app, host='0.0.0.0', port=args.port, log_level="info")
